home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-06 | 754 b | 32 lines | [TEXT/MPCC] |
- #include <stdlib.h>
- #include <unix.h>
- #include "CEquation.h"
-
- main( short argc, char* argv[] )
- {
- TYPE result;
- short ec;
- short a;
- char line[1024];
-
- CEquation *theEquation = new CEquation;
- theEquation->ClearAllVars();
- printf( "\nEE - Equation Evaluator" );
- printf( "\nBy Mark Morley December 1991" );
- printf( "\nEnter EXIT to quit.\n" );
- printf( "\nEE> " );
-
- for( gets( line ); !feof( stdin ); gets( line ) )
- {
- /* Call the evaluator. */
- if( (ec = theEquation->Evaluate( line, &result, &a )) == E_OK )
- {
- /* Only display the result if it was not an assignment. */
- if( ! a )
- printf( "%g\n", result );
- }
- else if( ec != E_EMPTY ) theEquation->ReportError();
- printf( "EE> " );
- }
- }
-